package cn.kailangtu.commontools;

import android.content.Context;

import androidx.recyclerview.widget.RecyclerView;

public  class APPSPUtils {
    private static APPSPUtils instance;
    /*
     * 单例模式创建
     * */
    public static APPSPUtils getInstance() {
        if (instance == null) {
            instance = new APPSPUtils();
        }
        return instance;
    }

    private Context context ;
    public void init(Context context){
       this.context = context;
    }

    /***
     * RTSP摄头IP
     */
    private final String SP_CAMERA_IP = "SP_CAMERA_IP";
    public String getCameraIp(){
        return SmSPUtils.getInstance("",context).getString(SP_CAMERA_IP,"192.168.1.10");
    }
    public void putCameraIp(String ip){
        SmSPUtils.getInstance("",context).put(SP_CAMERA_IP,ip);
    }

    /***
     * RTSP摄头IP
     */
    private final String SP_红外测温视频_SWITCH = "SP_红外测温视频_SWITCH";
    public String get红外测温视频Switch(){
        return SmSPUtils.getInstance("",context).getString(SP_红外测温视频_SWITCH,"开");
    }
    public void put红外测温视频Switch(String openOrClose){
        SmSPUtils.getInstance("",context).put(SP_红外测温视频_SWITCH,openOrClose);
    }


    /***
     * RTSP摄头端口
     */
    private final String SP_CAMERA_PORT = "SP_CAMERA_PORT";
    public int getCameraPort(){
        return SmSPUtils.getInstance("",context).getInt(SP_CAMERA_PORT,554);
    }
    public void putCameraPort(int port)
    {
        SmSPUtils.getInstance("",context).put(SP_CAMERA_PORT,port);
    }

    /***
     * RTSP摄头用户名
     */
    private final String SP_CAMERA_ACCOUNT = "SP_CAMERA_ACCOUNT";
    public String getCameraAccount()
    {
        return SmSPUtils.getInstance("",context).getString(SP_CAMERA_ACCOUNT,"admin");
    }
    public void putCameraAccount(String account)
    {
        SmSPUtils.getInstance("",context).put(SP_CAMERA_ACCOUNT,account);
    }

    /***
     * RTSP摄头密码
     */
    private final String SP_CAMERA_PWD = "SP_CAMERA_PWD";
    public String getCameraPwd()
    {
        return SmSPUtils.getInstance("",context).getString(SP_CAMERA_PWD,"xdjd2024");
    }
    public void putCameraPwd(String pwd)
    {
        SmSPUtils.getInstance("",context).put(SP_CAMERA_PWD,pwd);
    }


    /***
     * 以太网eth0，IP地址
     */
    private final String SP_LOCAL_IP_ETH0 = "SP_LOCAL_IP_ETH0";
    public String getLocalIpEth0(){
        return SmSPUtils.getInstance("",context).getString(SP_LOCAL_IP_ETH0,"192.168.1.128");
    }
    public void putLocalIpEth0(String ip){
        SmSPUtils.getInstance("",context).put(SP_LOCAL_IP_ETH0,ip);
    }

    /***
     * 以太网eth0,MASK
     */
    private final String SP_LOCAL_MASK_ETH0 = "SP_LOCAL_MASK_EHT0";
    public String getLocalMaskEth0(){
        return SmSPUtils.getInstance("", context).getString(SP_LOCAL_MASK_ETH0,"255.255.255.0");
    }
    public void putLocalMaskEth0(String mask)
    {
        SmSPUtils.getInstance("",context).put(SP_LOCAL_MASK_ETH0,mask);
    }

    /***
     * 以太网eth1，IP地址
     */
    private final String SP_LOCAL_IP_ETH1 = "SP_LOCAL_IP_ETH1";
    public String getLocalIpEth1(){
        return SmSPUtils.getInstance("",context).getString(SP_LOCAL_IP_ETH1,"200.200.200.10");
    }
    public void putLocalIpEth1(String ip){
        SmSPUtils.getInstance("",context).put(SP_LOCAL_IP_ETH1,ip);
    }

    /***
     * 以太网eth1,MASK
     */
    private final String SP_LOCAL_MASK_ETH1 = "SP_LOCAL_MASK_EHT1";
    public String getLocalMaskEth1(){
        return SmSPUtils.getInstance("", context).getString(SP_LOCAL_MASK_ETH1,"255.255.255.0");
    }
    public void putLocalMaskEth1(String mask)
    {
        SmSPUtils.getInstance("",context).put(SP_LOCAL_MASK_ETH1,mask);
    }


    /***
     * 串口1，
     */
    private final String SP_SERIALPORT_PORT_1 = "SP_SERIALPORT_PORT_1";
    public String getSerialPort1()
    {
        return SmSPUtils.getInstance("",context).getString(SP_SERIALPORT_PORT_1,"/dev/ttyHSL0");
    }
    public void putSerialPort1(String port)
    {
        SmSPUtils.getInstance("",context).put(SP_SERIALPORT_PORT_1,port);
    }

    /***
     * 串口1，波特率
     */
    private final String SP_SERIAL_BAUD_PORT_1 = "SP_SERIAL_BAUD_PORT_1";
    public String getSerialBaudPort1()
    {
        return SmSPUtils.getInstance("",context).getString(SP_SERIAL_BAUD_PORT_1,"38400");
    }
    public void putSerialBaudPort1(String baud)
    {
        SmSPUtils.getInstance("",context).put(SP_SERIAL_BAUD_PORT_1,baud);
    }

    /***
     * 串口1，奇偶校验位
     */
    private final String SP_SERIAL_CHECK_PORT_1 = "SP_SERIAL_CHECK_PORT_1";
    public int getSerialCheckPort1()
    {
        return SmSPUtils.getInstance("",context).getInt(SP_SERIAL_CHECK_PORT_1,0);
    }
    public void putSerialCheckPort1(int check)
    {
        SmSPUtils.getInstance("",context).put(SP_SERIAL_CHECK_PORT_1,check);
    }


    /***
     * 串口2，
     */
    private final String SP_SERIALPORT_PORT_2 = "SP_SERIALPORT_PORT_2";
    public String getSerialPort2()
    {
        return SmSPUtils.getInstance("",context).getString(SP_SERIALPORT_PORT_2,"/dev/ttyHSL1");
    }
    public void putSerialPort2(String port)
    {
        SmSPUtils.getInstance("",context).put(SP_SERIALPORT_PORT_2,port);
    }

    /***
     * 串口2，波特率
     */
    private final String SP_SERIAL_BAUD_PORT_2 = "SP_SERIAL_BAUD_PORT_2";
    public String getSerialBaudPort2()
    {
        return SmSPUtils.getInstance("",context).getString(SP_SERIAL_BAUD_PORT_2,"9600");
    }
    public void putSerialBaudPort2(String baud)
    {
        SmSPUtils.getInstance("",context).put(SP_SERIAL_BAUD_PORT_2,baud);
    }

    /***
     * 串口2，奇偶校验位
     */
    private final String SP_SERIAL_CHECK_PORT_2 = "SP_SERIAL_CHECK_PORT_2";
    public int getSerialCheckPort2()
    {
        return SmSPUtils.getInstance("",context).getInt(SP_SERIAL_CHECK_PORT_2,0);
    }
    public void putSerialCheckPort2(int check)
    {
        SmSPUtils.getInstance("",context).put(SP_SERIAL_CHECK_PORT_2,check);
    }


    /***
     * 挂牌密码
      */
    private final String SP_STOP_PWD = "SP_STOP_PWD";
    public String getStopPwd()
    {
        return SmSPUtils.getInstance("",context).getString(SP_STOP_PWD,"");
    }
    public void putStopPwd(String pwd){
        SmSPUtils.getInstance("",context).put(SP_STOP_PWD,pwd);
    }

    /***
     * 是否挂牌
     */
    private final String SP_IS_STOP = "SP_IS_STOP";
    public boolean isStop()
    {
        return SmSPUtils.getInstance("",context).getBoolean(SP_IS_STOP,false);
    }
    public void putStop(boolean isStop)
    {
        SmSPUtils.getInstance("",context).put(SP_IS_STOP,isStop);
    }


    /***
     * 挂牌密码，随机数
     */
    private final String SP_STOP_PWD_RANDOM = "SP_STOP_PWD_RANDOM";
    public String getStopPwdRandom()
    {
        return SmSPUtils.getInstance("",context).getString(SP_STOP_PWD_RANDOM,"");
    }
    public void putStopPwdRandom(String pwd)
    {
        SmSPUtils.getInstance("",context).put(SP_STOP_PWD_RANDOM,pwd);
    }


    /***
     * 高压侧参数设置密码
     */
    public final String SP_PWD_COMMON_SETTING = "SP_PWD_COMMON_SETTING";
    public String getCommonSettingPwd()
    {
        return SmSPUtils.getInstance("",context).getString(SP_PWD_COMMON_SETTING,"0000");
    }
    public void putCommonSettingPwd(String pwd){
        SmSPUtils.getInstance("",context).put(SP_PWD_COMMON_SETTING,pwd);
    }

    /***
     * 高压侧厂家设置密码
     */
    public final String SP_PWD_FACTORY_SETTING = "SP_PWD_FACTORY_SETTING";
    public String getFactorySettingPwd()
    {
        return SmSPUtils.getInstance("",context).getString(SP_PWD_FACTORY_SETTING,"0000");
    }
    public void putFactorySettingPwd(String pwd)
    {
        SmSPUtils.getInstance("",context).put(SP_PWD_FACTORY_SETTING,pwd);
    }

    /***
     * 低压端参数设置密码
     */
    public final String SP_PWD_COMMON_SETTING_LOW = "SP_PWD_COMMON_SETTING_LOW";
    public String getCommonSettingPwdLow()
    {
        return SmSPUtils.getInstance("",context).getString(SP_PWD_COMMON_SETTING_LOW,"0000");
    }
    public void putCommonSettingPwdLow(String pwd){
        SmSPUtils.getInstance("",context).put(SP_PWD_COMMON_SETTING_LOW,pwd);
    }

    /***
     * 低压端厂家设置密码
     */
    public final String SP_PWD_FACTORY_SETTING_LOW = "SP_PWD_FACTORY_SETTING_LOW";
    public String getFactorySettingPwdLow()
    {
        return SmSPUtils.getInstance("",context).getString(SP_PWD_FACTORY_SETTING_LOW,"0000");
    }
    public void putFactorySettingPwdLow(String pwd)
    {
        SmSPUtils.getInstance("",context).put(SP_PWD_FACTORY_SETTING_LOW,pwd);
    }


    /***
     * MODBUS从站地址
     */
    public final String SP_MODBUS_SLAVE_ADDRESS = "SP_MODBUS_SLAVE_ADDRESS";
    public byte getModbusSlaveAddress()
    {
        return (byte)SmSPUtils.getInstance("",context).getInt(SP_MODBUS_SLAVE_ADDRESS,1);
    }
    public void putModbusSlaveAddress(int address){
        SmSPUtils.getInstance("",context).put(SP_MODBUS_SLAVE_ADDRESS,address);
    }

    /***
     * 最后一次呆着的页面
     */
    public final String SP_LAST_MAIN_PAGE = "SP_LAST_MAIN_PAGE";
    public int getLastMainPage()
    {
        return SmSPUtils.getInstance("",context).getInt(SP_LAST_MAIN_PAGE,1);
    }
    public void putLastMainPage(int lastMainPage){
        SmSPUtils.getInstance("",context).put(SP_LAST_MAIN_PAGE,lastMainPage);
    }

    /***
     * 图表采样间隔
     */
    public final String SP_CHAT_REFRESH_TIME_SECOND = "SP_CHAT_REFRESH_TIME_SECOND";
    public int getChatRefreshTime()
    {
        return SmSPUtils.getInstance("",context).getInt(SP_CHAT_REFRESH_TIME_SECOND,1);
    }
    public void putChatRefreshTime(int second)
    {
        SmSPUtils.getInstance("",context).put(SP_CHAT_REFRESH_TIME_SECOND,second);
    }

    public final String SP_SPLASH_TITLE = "SP_SPLASH_TITLE";
    public String getSplashTitle()
    {
        return SmSPUtils.getInstance("",context).getString(SP_SPLASH_TITLE,"智能移变高压侧");
    }
    public void putSplashTitle(String title){
        SmSPUtils.getInstance("",context).put(SP_SPLASH_TITLE,title);
    }

    public final String SP_LAST_ERR_TIME = "SP_LAST_ERR_TIME";
    public String getLastErrTime()
    {
        return SmSPUtils.getInstance("",context).getString(SP_LAST_ERR_TIME,"");
    }
    public void putLastErrTime(String lastTime){
        SmSPUtils.getInstance("",context).put(SP_LAST_ERR_TIME,lastTime);
    }


    public final String SP_HOST_IP = "SP_HOST_IP";
    public String getHostIp()
    {
         return SmSPUtils.getInstance("",context).getString(SP_HOST_IP,"192.168.1.122");
    }
    public void putHostIp(String ip)
    {
        SmSPUtils.getInstance("",context).put(SP_HOST_IP,ip);
    }

    private final String SP_防越级跳闸_TYPE = "SP_防越级跳闸_TYPE";
    public String getFangType()
    {
        return SmSPUtils.getInstance("",context).getString(SP_防越级跳闸_TYPE,"短路防越级");
    }
    public void putFangType(String type){
        SmSPUtils.getInstance("",context).put(SP_防越级跳闸_TYPE,type);
    }


    private final String SP_防越级跳闸_LEVEL = "SP_防越级跳闸_LEVEL";
    public String getFangLevel()
    {
        return SmSPUtils.getInstance("",context).getString(SP_防越级跳闸_LEVEL,"一级");
    }
    public void putFangLevel(String level){
        SmSPUtils.getInstance("",context).put(SP_防越级跳闸_LEVEL,level);
    }

    private final String SP_防越级跳闸_Switch = "SP_防越级跳闸_Switch";
    public String getFangSwitch()
    {
        return SmSPUtils.getInstance("",context).getString(SP_防越级跳闸_Switch,"关");
    }
    public void putFangSwitch(String value){
        SmSPUtils.getInstance("",context).put(SP_防越级跳闸_Switch,value);
    }

    private final String SP_防越级跳闸_IP = "SP_防越级跳闸_IP";
    public String getFangIP()
    {
        return SmSPUtils.getInstance("",context).getString(SP_防越级跳闸_IP,"192.168.1.199");
    }
    public void putFangIP(String ip){
        SmSPUtils.getInstance("",context).put(SP_防越级跳闸_IP,ip);
    }

}
